package it.polimi.entities.web;

import java.util.ArrayList;
import java.util.List;

import it.polimi.entitiesDTO.AttractionDTO;
import it.polimi.entitiesDTO.FlightDTO;
import it.polimi.entitiesDTO.HotelDTO;
import it.polimi.entitiesDTO.PacketDTO;
import it.polimi.entitiesManagers.AttractionMgr;
import it.polimi.entitiesManagers.HotelMgr;
import it.polimi.entitiesManagers.PacketMgr;
import it.polimi.entitiesManagers.PersonalizedPacketMgr;
import it.polimi.entitiesManagers.TransportMgr;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;

@ManagedBean(name="VisualizationBean")
@SessionScoped
public class VisualizationBean {

	
@EJB	
private AttractionMgr amgr;
@EJB
private TransportMgr tmgr;
@EJB
private HotelMgr hmgr;
@EJB
private PacketMgr pmgr;
@EJB
private PersonalizedPacketMgr ppmgr;
	
private FlightDTO flightDTO;
private HotelDTO hotelDTO;
private AttractionDTO attractionDTO;
private PacketDTO packetDTO;


private String city;
private String airportName;
private int id;

private List<String> airports;

private List<String> hotels;

private List<String> attractions;

private List<String> flights;

private List<String> packets;

private List<String> userConfirmedPackets;

private List<String> userPendingPackets;

private List<String> employeePackets;

private String temp;

private List<String> temp1;

private List<String> temp2;

private int id2;

/*---------------------------
 *-------CLASS METHODS-------
 *---------------------------
 */


public String visalizeBasePacket(){
	temp = new String();
	temp1 = new ArrayList<String>();
	temp2 = new ArrayList<String>();
	temp1 = pmgr.getAttractionsFromPacket(id2);
	temp2 = pmgr.getFlightsFromPacket(id2);
	temp = pmgr.searchPersonalizedPacketById(id2);
	return "/user/showComponents";
}

public VisualizationBean(){
	clearAll();
	
}

public void visualizeAll(){
	this.hotels= hmgr.showAllHotels();
	this.flights= tmgr.findAllFlight();
	this.airports = tmgr.showAllAirport();
	this.attractions = amgr.showAllAttractions();
	this.packets = pmgr.getAllPacket();
}

public void visualizeHotel(){
}
public void visualizeFlight(){
}
public void visalizeAirports(){
}
public void visualizeAttractions(){
}

public void visualizePacket(){
	this.packets = pmgr.getAllPacket();
}

public void viualizePacketByCity(){
	this.packets= new ArrayList<String>();
	this.packets=pmgr.getPacketByCity(city);
	this.city= new String();
}

public void seeExternalPacket(){
	temp = new String();
	temp1 = new ArrayList<String>();
	temp2 = new ArrayList<String>();
	temp1 = ppmgr.getAttractionsFromPacket(id);
	temp2 = ppmgr.getFlightsFromPacket(id);
	temp = ppmgr.searchPersonalizedPacketById(id);
}
public void visualizeEmployeePackets(){
	this.employeePackets = pmgr.getEmployeePacket();
}
public void visualizeUserPendingPackets(){
	this.userPendingPackets = ppmgr.getUserPendingPacket();
}

public void visualizeUserConfirmedPackets(){
	this.userConfirmedPackets = ppmgr.getUserConfirmedPacket();
}

public void clearAll(){
	
	this.flightDTO=new FlightDTO();
	this.hotelDTO= new HotelDTO();
	this.attractionDTO= new AttractionDTO();
	this.packetDTO= new PacketDTO();
	this.city= new String();
	this.airportName= new String();
	this.id=0;
	this.airports= new ArrayList<String>();
	this.hotels= new ArrayList<String>();
	this.attractions= new ArrayList<String>();
	this.flights= new ArrayList<String>();
	this.packets= new ArrayList<String>();
	this.employeePackets = new ArrayList<String>();
	this.userConfirmedPackets = new ArrayList<String>();
	this.temp = new String();
	this.id2=0;
}

/*---------------------------
 *---SETTERS & GETTERS-------
 *---------------------------
 */
public List<String> getEmployeePackets() {
	return employeePackets;
}

public void setEmployeePackets(List<String> employeePackets) {
	this.employeePackets = employeePackets;
}
public FlightDTO getFlightDTO() {
	return flightDTO;
}
public void setFlightDTO(FlightDTO flightDTO) {
	this.flightDTO = flightDTO;
}
public HotelDTO getHotelDTO() {
	return hotelDTO;
}
public void setHotelDTO(HotelDTO hotelDTO) {
	this.hotelDTO = hotelDTO;
}
public AttractionDTO getAttractionDTO() {
	return attractionDTO;
}
public void setAttractionDTO(AttractionDTO attractionDTO) {
	this.attractionDTO = attractionDTO;
}
public PacketDTO getPacketDTO() {
	return packetDTO;
}
public void setPacketDTO(PacketDTO packetDTO) {
	this.packetDTO = packetDTO;
}
public String getCity() {
	return city;
}
public void setCity(String city) {
	this.city = city;
}
public String getAirportName() {
	return airportName;
}
public void setAirportName(String airportName) {
	this.airportName = airportName;
}
public int getId() {
	return id;
}
public void setId(int id) {
	this.id = id;
}

public List<String> getAirports() {
	return airports;
}

public void setAirports(List<String> airports) {
	this.airports = airports;
}

public List<String> getHotels() {
	return hotels;
}

public void setHotels(List<String> hotels) {
	this.hotels = hotels;
}

public List<String> getAttractions() {
	return attractions;
}

public void setAttractions(List<String> attractions) {
	this.attractions = attractions;
}

public List<String> getFlights() {
	return flights;
}

public void setFlights(List<String> flights) {
	this.flights = flights;
}

public List<String> getPackets() {
	return packets;
}

public void setPackets(List<String> packets) {
	this.packets = packets;
}

public List<String> getUserConfirmedPackets() {
	return userConfirmedPackets;
}

public void setUserConfirmedPackets(List<String> userConfirmedPackets) {
	this.userConfirmedPackets = userConfirmedPackets;
}

public List<String> getUserPendingPackets() {
	return userPendingPackets;
}

public void setUserPendingPackets(List<String> userPendingPackets) {
	this.userPendingPackets = userPendingPackets;
}

public String getTemp() {
	return temp;
}

public void setTemp(String temp) {
	this.temp = temp;
}

public List<String> getTemp1() {
	return temp1;
}

public void setTemp1(List<String> temp1) {
	this.temp1 = temp1;
}

public List<String> getTemp2() {
	return temp2;
}

public void setTemp2(List<String> temp2) {
	this.temp2 = temp2;
}

public int getId2() {
	return id2;
}

public void setId2(int id2) {
	this.id2 = id2;
}




}
